    function regSubmit(){

		var code =$.trim($('#code').val());
        var mobile =$.trim($('#mobile').val());
		var mobile_verify = $.trim($('#mobile_verify').val());
		var password = $.trim($('#password').val());
	    var pwdconfirm = $.trim($('#pwdconfirm').val());
		 var qq = $.trim($('#qq').val());
		var partten = /^1[3-9]\d{9}$/;
		var remail = /^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]$/;
		 var reg_name = /^[a-z_A-Z·\u4e00-\u9fa5]+$/;
		var recommend = $.trim($('#recommend').val());
        if (code == "" || code == null || code.length!=4) {
			layer.msg('请输入验证码或验证码有误');
            return false;
        }
		else if (mobile == "" || mobile == null || mobile == "请输入手机号") {
			layer.msg('请输入手机号');
            return false;
        }
		else if(!partten.test(mobile)){
			layer.msg("请输入正确的手机号码");
			return false;
		}
		else if (mobile_verify == "" || mobile_verify == null) {
			layer.msg('请输入手机验证码');
            return false;
        }
		else if(password==''){
			layer.msg('请输入登录密码');
			return false;
		}
		else if(password.length<6 || password.length>20 ){
			layer.msg('密码请输入6-20位之间');
			return false;
		}
	    else if(pwdconfirm==''){
			layer.msg('请输入确认密码');
			return false;
		}
		else if(password!=pwdconfirm){
			layer.msg('新登录密码和确认密码要相同');
			return false;
		}
	    else if(qq==''){
			layer.msg('请输入QQ号码');
			return false;
		}
		else{
            $.ajax({
	            type: "POST",
	            url: "/user-mreg",
	            data: {dosubmit:1,mobile:mobile,mobile_verify:mobile_verify,password:password,pwdconfirm:pwdconfirm,recommend:recommend,qq:qq,terminal:1,siteid:1},
	            dataType: "json",
	            success: function (data) {
					if(data==-1){
                        layer.msg('注册功能已关闭，请联系网站管理员！');
                    }
					 else if(data==-2){
                        layer.msg('手机号码错误');
                    }
					 else if(data==-3){
                        layer.msg('手机号码已存在');
                    }else if(data==-4){
                        layer.msg('两次密码输入不相同');
                    }else if(data==-5){
                        layer.msg('推荐人不能是自己哦');
                    }else if(data==-6){
                        layer.msg('推荐人不存在哦');
                    }else if(data==-7){
                        layer.msg('手机验证码有误，请勿非法操作哦');
                    }
					else{
						window.location.href='../../user-login.htm'/*tpa=http://dstz88.com/user-init*/;
						}
	            },
	            error:function(e){
					window.location.href='../../user-login.htm'/*tpa=http://dstz88.com/user-init*/;
		        }
	        });
        }
    }
    if (document.addEventListener) { 
        document.addEventListener("keypress", fireFoxHandler, true);
    } else {
        document.attachEvent("onkeypress", ieHandler);
    }
    function fireFoxHandler(evt) {
        if (evt.keyCode == 13) {
            regSubmit()
        }
    }
    function ieHandler(evt) {
        if (evt.keyCode == 13) {
            regSubmit()
        }
    }
